package com.example.common.result;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class PageResult<T> {
    private long total = 0;
    private List<T> list = new ArrayList<>();

    public PageResult() {
    }

    public PageResult(long total, List<T> list) {
        this.total = total;
        this.list = list;
    }

    /**
     * 方便分页使用
     * @param i
     * @param list
     * @param <E>
     * @return
     */
    public static <E> PageResult<E> result(long i, List<E> list) {
        return new PageResult<>(i, list);
    }
}
